home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* Initialize TNC with file *)
- (* *)
- (* Copyright 1988, 1989, 1990, 1991 by H. Roy Engehausen. All rights *)
- (* reserved. *)
- (* *)
- (* This software may be freely distributed and used, but it may not *)
- (* under any circumstances be sold by anyone other than the author. *)
- (* It may be distributed by a commercial company as long as it is *)
- (* for no cost. *)
- (* *)
- (*===========================================================================*)
-
- {$UNDEF DEBUG_MODEM}
-
- (*===========================================================================*)
- (* Initialize tnc with file *)
- (*===========================================================================*)
-
- PROCEDURE t_file_init;
-
- VAR
- f : TEXT;
- i : INTEGER;
-
- BEGIN;
-
- {$IFDEF DEBUG_MODEM}
- WRITELN('Start of file read');
- {$ENDIF}
-
- WITH active_port^, active_tcb^ DO
- BEGIN;
-
- (*-------------------------------------------------------------------*)
- (* Set for the unproto channel *)
- (*-------------------------------------------------------------------*)
-
- IF port_type <> port_modem THEN
- BEGIN;
- channel := 0;
- port_chan_s := port_char + '0';
- END
- ELSE
- BEGIN;
- channel := 1;
- port_chan_s := port_char + '1';
- END;
-
- (*-------------------------------------------------------------------*)
- (* Read in first file *)
- (*-------------------------------------------------------------------*)
-
- ASSIGN(f, first_load);
-
- {$I-}
- RESET(f);
- {$I+}
-
- i := IORESULT;
- IF i = 2 THEN
- BEGIN;
- window_write('', '***** Port initialization file (' + first_load
- + 'is missing');
- EXIT;
- END;
-
- IF i <> 0 THEN
- BEGIN;
- STR(i, t_str);
- window_write('', '***** Port initialization file (' + first_load
- + 'is getting IO Error ' + t_str);
- EXIT;
- END;
-
- WHILE NOT EOF(f) DO
- BEGIN;
-
- READLN(f, t_str);
-
- {$IFDEF DEBUG_MODEM}
- WRITELN('Writing data -- ', LENGTH(t_str), ' -- ', t_str);
- {$ENDIF}
-
- IF (LENGTH(t_str) > 1) AND
- ((t_str[1] = escape) OR (t_str[2] = '%')) THEN
- BEGIN;
- t_str := COPY(t_str, 2, 255);
- cmd_tnc(@t_str, TRUE)
- END
- ELSE
- IF LENGTH(t_str) > 0 THEN
- BEGIN;
- send_tnc_data_str(t_str);
- send_tnc_data_str(cr);
- send_flush;
- END;
-
- IF port_type = port_modem THEN
- DELAY(300);
- gc;
-
- END;
-
- CLOSE(f);
-
- END;
-
- END;